package com.bdqn.mapper.impl;

import com.bdqn.mapper.SupplierMapper;
import com.bdqn.pojo.Supplier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service("supplierMapper")
public class SupplierMapperImpl implements SupplierMapper {
    @Autowired
    private SupplierMapper supplierMapper;

    /**
     * 查询供货商信息
     *
     * @param supName
     * @return
     */
    @Override
    public List<Supplier> selectSupplierBysupNameList(String supName) {
        try {
            return supplierMapper.selectSupplierBysupNameList(supName);
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }

    public SupplierMapper getSupplierMapper() {
        return supplierMapper;
    }

    public void setSupplierMapper(SupplierMapper supplierMapper) {
        this.supplierMapper = supplierMapper;
    }

    @Override
    public List<Supplier> getAll() {
        try {
            return supplierMapper.getAll();
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }

    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Override
    public int delID(Integer id) {
        try {
            return supplierMapper.delID(id);
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
}
